<template>
    <div class="header">
        <!--折叠按钮-->
        <div class="collapse-btn" @click="collapseChage">
            <i v-if="!collapse" class="el-icon-s-fold"></i>
            <i  v-else class="el-icon-s-unfold"></i>
        </div>
        <!--LOGO-->
        <div class="logo">证券交易系统</div>
        <!--用户信息和下拉菜单-->
        <div class="header-right">
            <div class="header-user-con">
                <!--在ElementsUI里下拉菜单-->
                <el-dropdown class="user-name" trigger="click">
                <span class="el-dropdown-link">
                    {{username}}
                    <i class="el-icon-caret-bottom"></i>
                </span>
                    <el-dropdown-menu slot="dropdown">
                        <el-dropdown-item command="">退出登录</el-dropdown-item>
                    </el-dropdown-menu>
                </el-dropdown>
            </div>
        </div>
    </div>

</template>

<script>
    export default {
        name: "Header",
        data(){
            return{
                username:"guest",
                collapse:false
            }
        },methods:{
            collapseChage(){
                this.collapse = !this.collapse
                /*
                * 点击状态往告诉其他路由我
                * 现在是一个什么样的状态
                * */
                this.$bus.emit('collapse', this.collapse);
            }
        }
    }
</script>

<style scoped>
    .header {
        position: relative;
        box-sizing: border-box;
        width: 100%;
        height: 70px;
        font-size: 22px;
        color: #fff;
    }

    .collapse-btn {
        float: left;
        padding: 0 21px;
        cursor: pointer;
        line-height: 70px;
    }

    .header .logo {
        float: left;
        width: 250px;
        line-height: 70px;
    }

    .header-right {
        float: right;
        padding-right: 50px;
    }

    .header-user-con {
        display: flex;
        height: 70px;
        align-items: center;
    }

    .btn-bell .el-icon-bell {
        color: #fff;
    }

    .user-name {
        margin-left: 10px;
    }

    .user-avator {
        margin-left: 20px;
    }

    .user-avator img {
        display: block;
        width: 40px;
        height: 40px;
        border-radius: 50%;
    }

    .el-dropdown-link {
        color: #fff;
        cursor: pointer;
    }

    .el-dropdown-menu__item {
        text-align: center;
    }
</style>